/*
 * @Author: CodeHare
 * @Date: 2023-09-08 08:53:31
 * @LastEditors: CodeHare
 * @LastEditTime: 2023-10-27 21:27:06
 * @Description: 业主首页Tab
 */
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yt_devops/pages/site/site_view.dart';
import 'package:yt_devops/pages/site/widgets/home_statistics.dart';
import 'package:yt_devops/utils/constants/permission_page_constant.dart';
import 'package:yt_devops/utils/func_utils.dart';

class OwenerHomeController extends GetxController with GetTickerProviderStateMixin{
  int selectedIndex = 0;
  TabController? tabController;
  List<Widget> homeTabviewChildren = [];
  @override
  void onInit() {
    super.onInit();
    tabController = TabController(length: 3, vsync: this);
    if(FuncUtils.isPassAuthority([PermissionConstant.homeSiteList])){
      homeTabviewChildren.add( SiteHomePage());
    }
    if(FuncUtils.isPassAuthority([PermissionConstant.homeStatic])){
      homeTabviewChildren.add( const HomeStatistics());
    }
  }

  @override
  void onReady() {}

  @override
  void onClose() {}

  onItemTapped(index) {
    selectedIndex = index;
    tabController!.animateTo(index);
    update();
  }
}
